#include "loadscreen.h"

SDL_Surface * background;
TTF_Font * font;
SDL_Rect position = {0,0};

void loading_screen_init()
{
    background = sdl_load_image("fondocarga.png");
    if(!background)
        printf("No se pudo cargar el fondo!!!");

    font = sdl_load_font("FreeMonoBold.ttf",12);
}

void loading_screen_close()
{
    SDL_FreeSurface(background);
}

void loading_screen_paint(char *text)
{
    sdl_clear_screen(0,0,0);
    sdl_paint_surface(background,&position);

    if(text)
    {
        SDL_Surface* stext = sdl_draw_text(font,255,255,255,0,0,0,0,0,text,blended);
        SDL_Rect txtPosition = {15,15};

        sdl_paint_surface(stext,&txtPosition);
        SDL_FreeSurface(stext);
    }

    sdl_flip();


}
